package main.service;

import java.util.*;
import java.math.BigDecimal;

import main.service.mail.MailMain;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import main.model.*;
import main.dao.*;
import main.vo.*;
import main.service.EmailUtils;
import main.service.HttpUtil;
import main.service.mail.bean.EnterpriseMailBean;

@Service
public class TestUserService {
private static void input(String user,String password) {
        /*EmailUtils.ACCOUNT = "qintianshu@jspdi.com.cn";
        EmailUtils.PASSWORD = "Qts970516";*/
        EmailUtils.ACCOUNT = user;
        EmailUtils.PASSWORD = password;
        EmailUtils.START_TIME = "1970-01-01";
    }

//系统生成代码,请不要修改或删除 <actionStart:Test>
public List<Test> Test(String user,String password) throws Exception {
	//请添加你的业务代码
	/*input(user, password);

        // 获取邮箱的 token 后，获取邮件未读
        TokenBean tokenBean = HttpUtil.getTokenBean(HttpUtil.MAIL);
        HttpUtil.getMailCountBean(tokenBean.access_token);

        // 获取登录的 token 后，单点登录
        TokenBean tokenBeanLogin = HttpUtil.getTokenBean(HttpUtil.LOGIN);
        HttpUtil.getLoginUrl(tokenBeanLogin.access_token);

        // 获取登录的 token 后，单点登录
        TokenBean tokenBeanLog = HttpUtil.getTokenBean(HttpUtil.LOG);
        HttpUtil.getLogOperation(tokenBeanLog.access_token);
        HttpUtil.getLoginLog(tokenBeanLog.access_token);*/

        List<EnterpriseMailBean> list = MailMain.getMail10();

        List<Test> testdatas = new ArrayList<>();
        Test testdata1 = new Test();
        testdata1.setSubject("i.subject");
        testdata1.setSender("i.sender");
        testdata1.setReceiver("i.receiveAddress");
        testdata1.setSendDate("i.sentDate");
        testdata1.setSize("i.size");
        testdata1.setPriority("i.priority");
        testdatas.add(testdata1);

        list.forEach(i->{
        	Test testdata = new Test();
        	testdata.setSubject(i.subject);
        	testdata.setSender(i.sender);
        	testdata.setReceiver(i.receiveAddress);
        	testdata.setSendDate("i.sentDate");
        	testdata.setSize("i.size");
        	testdata.setPriority(i.priority);
            testdatas.add(testdata);
        });
        System.out.println(testdatas.size());
        return testdatas;
}
    public static void main(String[] args) {
        try {
            TestUserService testUserService = new TestUserService();
            testUserService.Test("","");
        } catch (Exception e) {

        }
    }

//系统生成代码,请不要修改或删除 <actionEnd:Test>


}